﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.QueryEntity;

    [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall), AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class EDIService : IEDIService
    {
        public string ASNImportByEDI_YITAI(List<string> data, string ownerID, string vendorID, PubParasInfo pubParasInfo)
        {
            try
            {
                EdiLogBLL ediBLL = new EdiLogBLL(pubParasInfo);
                return ediBLL.ASNImportByEDI_YITAI(data, ownerID, vendorID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "EDIService异常");
            }
            return "";
        }

        public DataSet GetEdiLogInfoByQueryEntity(EdiLogQueryEntity ediLogQuery)
        {
            try
            {
                EdiLogBLL ediLogBLL = new EdiLogBLL();
                return ediLogBLL.GetEdiLogByQueryList(ediLogQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return null;
        }

        public DataSet GetEdiLogInfoByWhere(List<string> sqlWhere, EdiLogQueryEntity ediLogQuery)
        {
            try
            {
                EdiLogBLL ediLogBLL = new EdiLogBLL();
                return ediLogBLL.GetEdiLogByWhere(sqlWhere, ediLogQuery);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return null;
        }

        public bool InsertEdiLogInfo(EdiLogInfo ediLogInfo)
        {
            try
            {
                EdiLogBLL ediLogBLL = new EdiLogBLL();
                return ediLogBLL.InsertEdiLog(ediLogInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return false;
        }

        public bool InsertEdiLogInfos(List<EdiLogInfo> ediLogInfos)
        {
            try
            {
                EdiLogBLL ediLogBLL = new EdiLogBLL();
                return ediLogBLL.InsertEdiLogs(ediLogInfos);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "MessageService异常");
            }
            return false;
        }

        public DataSet InvExportByEDI_SkyTrans(string ownerID, string dbLoginID)
        {
            EdiLogBLL ediLogBLL = new EdiLogBLL();
            return ediLogBLL.InvExportByEDI_SkyTrans(ownerID, dbLoginID);
        }

        public string OrderImportByEDI_SkyTrans(List<string> data, string ownerID, string dbLoginID, char splitChar)
        {
            EdiLogBLL ediLogBLL = new EdiLogBLL();
            return ediLogBLL.OrderImportByEDI_SkyTrans(data, ownerID, dbLoginID, splitChar);
        }

        public string OrderImportByEDI_YITAI(List<string> data, string ownerID, PubParasInfo pubParasInfo)
        {
            try
            {
                EdiLogBLL ediBLL = new EdiLogBLL(pubParasInfo);
                return ediBLL.OrderImportByEDI_YITAI(data, ownerID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "EDIService异常");
            }
            return "";
        }

        public DataSet ShipmentExportByEDI_SkyTrans(string ownerID, string dbLoginID)
        {
            EdiLogBLL ediLogBLL = new EdiLogBLL();
            return ediLogBLL.ShipmentExportByEDI_SkyTrans(ownerID, dbLoginID);
        }

        public string SkuImportByEDI_SkyTrans(List<string> data, string ownerID, string dbLoginID, char splitChar)
        {
            EdiLogBLL ediLogBLL = new EdiLogBLL();
            return ediLogBLL.SkuImportByEDI_SkyTrans(data, ownerID, dbLoginID, splitChar);
        }

        public int UpdateOrdersEdiFlag(List<string> orderIDs, string ownerID, string dbLoginID)
        {
            EdiLogBLL ediLogBLL = new EdiLogBLL();
            return ediLogBLL.UpdateOrdersEdiFlag(orderIDs, ownerID, dbLoginID);
        }
    }
}

